package com.wangsd.web.coupon.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * 用户领取的优惠券
 */
@Data
@Entity
@Table(name = "member_coupon")
@ApiModel(value = "会员优惠券", description = "会员优惠券")
public class MemberCoupon {

    @ApiModelProperty(value = "id")
    /*mybatis plus 自增主键*/
    @TableId(type = IdType.AUTO)
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date createdTime;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updatedTime;

    @ApiModelProperty(value = "（逻辑删除）是否已删；0，未删，1，已删")
    @TableField(fill = FieldFill.INSERT)
    private Integer deleted;

    @ApiModelProperty(value = "优惠券批次号")
    private String stockId;

    @ApiModelProperty(value = "商家券Code")
    private String couponCode;

    @ApiModelProperty(value = "微信优惠券id")
    private Long wxCouponId;

    @ApiModelProperty(value = "会员id")
    private Long memberId;

    @ApiModelProperty(value = "会员miniOpenid")
    private String openid;

    @ApiModelProperty(value = "会员PayOpenid")
    private String payOpenid;

    @ApiModelProperty(value = "0未核销，1已核销，2，已过期")
    @Column(name = "state",columnDefinition = "int(11) default 0 not null")
    private Integer state;

    @ApiModelProperty(value = "1,代金券，2，商家券")
    @Column(name = "type",columnDefinition = "int(11) default 1 not null")
    private Integer type;

    @ApiModelProperty(value = "门店id")
    private String outShopId;

    @Transient
    @TableField(exist = false)
    private String nickName;

    @Transient
    @TableField(exist = false)
    private String couponName;

    @ApiModelProperty(value = "商户请求单号")
    @Transient
    @TableField(exist = false)
    private String outRequestNo;

    @ApiModelProperty(value = "商户单号")
    private String outTradeNo;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date beginTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;
}
